package cn.jdy.plugins.wap;



import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Restrictions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.jdy.common.ctrl.BaseCtrl;
import cn.jdy.framework.util.StringUtil;
import cn.jdy.plugins.entity.PptImg;
import cn.jdy.plugins.entity.PptList;
import cn.jdy.plugins.service.PptListService;


/**
 * @title ppt列表
 * @author jga
 * @since 2017-11-9
 */

@Controller
@RequestMapping("/pptList")
public class PptListCtrl extends BaseCtrl {
	@Autowired
	private PptListService pptListService;

	/**
	 * 加载ppt列表
	 * 
	 * @param rpSendId
	 * @return
	 */
	@RequestMapping("getpptlist")
	@ResponseBody
	public Map<String, Object> getpptlist(Long liveId, int pageNo, int pageSize) {
		Map<String, Object> jsonMap = new HashMap<String, Object>();
		Long count = 0L;
		List<PptList> list = new ArrayList<PptList>();
		DetachedCriteria dc = DetachedCriteria.forClass(PptList.class);
		if (!StringUtil.isNullOrEmpty(liveId)) {
			dc.add(Restrictions.eq("liveId", liveId));
		}
		dc.addOrder(Order.asc("createTime"));

		list = pptListService.find(dc,pageNo, pageSize);
		count = pptListService.count(dc);
		jsonMap.put("datalist", list);
		jsonMap.put("iTotalDisplayRecords", count);
		return jsonMap;
	}
	

}
